package com.example.demo.dao;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import com.example.demo.entity.Sequence;

@Mapper
public interface SequenceMapper extends MyMapper<Sequence> {
	@Select("SELECT current_value+increment as id FROM sys_sequence WHERE name=#{name} FOR UPDATE")
	public Long getIncrementValue(String name);

	@Update("UPDATE sys_sequence SET current_value=current_value+increment WHERE name=#{name} ")
	public void updateCurrentValue(String name);
}